package com.xjoyt.pay.master.po;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.ForeignKey;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.GenericGenerator;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.xjoyt.pay.constants.DateConstant;
import com.xjoyt.pay.vo.MoneyType;

/**
 * 商户资金池
 * 
 * @author Administrator
 *
 */
@Entity
@Table(name = "t_merchant_money")
public class MerchantMoney {

	@Id
	@GeneratedValue(generator = "uuid")
	@GenericGenerator(name = "uuid", strategy = "uuid2")
	@Column(name = "merchant_money_id", length = 36)
	public String id;

	/**
	 * 商户
	 */
	@ManyToOne(targetEntity = Merchant.class, cascade = {})
	@JoinColumn(name = "merchant_id", foreignKey = @ForeignKey(name = "none"))
	public Merchant merchant;

	/**
	 * 通道
	 */
	@ManyToOne(targetEntity = Channel.class, cascade = {})
	@JoinColumn(name = "channel_id", foreignKey = @ForeignKey(name = "none"))
	public Channel channel;

	/**
	 * 日期
	 */
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "added_date")
	@JsonFormat(pattern = DateConstant.DATE_TIME_FORMAT_PATTERN, timezone = "GMT+8")
	public Date addedDate;

	/**
	 * 金额(分)
	 */
	@Column(name = "money")
	public Long money;

	/**
	 * 资金池类型
	 */
	@Column(name = "type", length = 20)
	@Enumerated(EnumType.STRING)
	public MoneyType type;

	/**
	 * 流水号
	 */
	@Column(name = "no", length = 50)
	public String no;
}
